using System;
using System.Collections.Generic;
using System.Text;
using System.Web.Profile;
using AAM.BIZ;

namespace CMS.BIZ
{
    public class BizProfile : ProfileBase, IBizObject
    {

        public static readonly ObjectType ObjectType = new ObjectType("BizProfile");

        private ObjectID id;
        private string cultureCode = "";

        public BizProfile()
            : base()
        {
        }

        #region IBizObject Members

        public ObjectID ID
        {
            get { if (id == null) id = new ObjectID(ObjectType, new object[] { base.UserName }); return id; }
        }

        public ObjectType Type
        {
            get { return ID.Type; }
        }

        public string TypeName
        {
            get { return Type.Name; }
        }

        public string Culture
        {
            get { return (string)base.GetPropertyValue("Culture"); }
            set { base.SetPropertyValue("Culture", value); }
        }

        #endregion

        public override bool Equals(object obj)
        {
            if (!(obj is IBizObject)) return false;
            IBizObject other = (IBizObject)obj;
            return id.Equals(other.ID);
        }
        public override int GetHashCode()
        {
            return id.GetHashCode();
        }
        public override string ToString()
        {
            return id.ToString();
        }

        public string CultureCode
        {
            get { return cultureCode; }
            set { cultureCode = value; }
        }
    }
}
